package top.cflwork.service.impl;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;
import java.util.Map;

import top.cflwork.dao.ShopColCarDao;
import top.cflwork.vo.ShopColCarVo;
import top.cflwork.service.ShopColCarService;
import top.cflwork.common.SequenceId;


@Service
public class ShopColCarServiceImpl implements ShopColCarService {
	@Autowired
	private ShopColCarDao shopColCarDao;
    @Autowired
    private SequenceId sequenceId;
	@Override
    @Transactional
	public ShopColCarVo get(String id){
		return shopColCarDao.get(id);
	}
	
	@Override
    @Transactional
	public List<ShopColCarVo> list(ShopColCarVo shopColCarVo){
		return shopColCarDao.list(shopColCarVo);
	}
	
	@Override
    @Transactional
	public long count(ShopColCarVo shopColCarVo){
		return shopColCarDao.count(shopColCarVo);
	}
	
	@Override
    @Transactional
	public int save(ShopColCarVo shopColCar){
	    shopColCar.setId(sequenceId.nextId());
	    return shopColCarDao.save(shopColCar);
	}
	
	@Override
    @Transactional
	public int update(ShopColCarVo shopColCar){
		return shopColCarDao.update(shopColCar);
	}
	
	@Override
    @Transactional
	public int remove(String id){
		return shopColCarDao.remove(id);
	}
	
	@Override
    @Transactional
	public int batchRemove(String[] ids){
		return shopColCarDao.batchRemove(ids);
	}

    @Override
    @Transactional
    public int batchSave(List<ShopColCarVo> shopColCarList){
			shopColCarList.forEach(e -> e.setId(sequenceId.nextId()));
        return shopColCarDao.batchSave(shopColCarList);
    }
}
